//
//  HBTagWaterCollectionViewCell.m
//  HBLibary_Example
//
//  Created by Rambo on 2018/6/19.
//  Copyright © 2018年 Rambo. All rights reserved.
//

#import "HBTagWaterCollectionViewCell.h"


NSString *const HBTagWaterCollectionViewCellId = @"HBTagWaterCollectionViewCellId";

@interface HBTagWaterCollectionViewCell ()

@property (nonatomic, strong) UILabel *label;


@end

@implementation HBTagWaterCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
        [self setUI];
    }
    return self;
}

#pragma mark - 初始化

- (void)setUI{
    UIView *superView = self.contentView;
    
    superView.layer.borderWidth = 0.5;
    superView.layer.borderColor = [UIColor blackColor].CGColor;
    
    self.label = ({
        UILabel *label = [[UILabel alloc] init];
        label.textColor = [UIColor redColor];
        label.font = HBTagWaterCollectionViewCell.titleFont;
        label.numberOfLines = 0;
        [superView addSubview:label];
//        UIEdgeInsets insets = HBTagWaterCollectionViewCell.edgeInsets;

        label;
    });
}

- (void)layoutSubviews{
    [super layoutSubviews];
    UIEdgeInsets insets = HBTagWaterCollectionViewCell.edgeInsets;
    self.label.frame = CGRectMake(insets.left, insets.top, self.frame.size.width - insets.left - insets.right, self.frame.size.height - insets.top - insets.bottom);
}

#pragma mark - set

- (void)setTitle:(NSString *)title{
    _title = title;
    self.label.text = _title;
}

#pragma mark - class property

+ (UIFont *)titleFont{
    return [UIFont systemFontOfSize:12];
}

+ (UIEdgeInsets)edgeInsets{
    return UIEdgeInsetsMake(10, 14, 10, 14);
}

@end
